/*
 * author      : 吴中勤 
 * date        : 2018/8/17
 * description : Sap订单行
 */

package com.deepexi.adapter.sdk.sap.dto.order;

import com.deepexi.adapter.common.BaseDto;
import com.google.gson.annotations.SerializedName;

public class SapOrderLine extends BaseDto {

    /*
    LINES	外围行项目号			    外围生成的行项目编号
    MATNR	物料号 	    		    订单行项目物料编码
    KBETR	销售价格 	        		该物料的销售价格
    MENGE	数量	            		销售的数量
    ITCAT	项目类别	        		该物料的项目类别
    LGORT	库存地点	        		物料主数据中的库存位置   车辆不需要,暂定3001
    REBATE	百分之百折扣标识	   		百分之百折扣标识
    CHANGE	订单行项目修改标识 		添加'A'；删除'D'；修改'C'
    POSNR	SAP行项目号	        	修改订单行时传入SAP返回的行项目编号
    TOBUY	自动创建采购申请标识 		采购'X'；不采购''
    */
    private static final int COUPON_DESC_MAX_LENGTH = 60;

    public static final String CHANGE_TYPE_ADD = "A";
    public static final String CHANGE_TYPE_DELETE = "D";
    public static final String CHANGE_TYPE_UPDATE = "C";
    public static final String AUTO_PURCHASE_YES = "X";

    @SerializedName("LINES")
    private String externalLineNo;

    @SerializedName("MATNR")
    private String materialNo;

    @SerializedName("KBETR")
    private String price;

    @SerializedName("MENGE")
    private String quantity;

    @SerializedName("ITCAT")
    private String itemCatalog;

    // 车辆无需库位, 精品需要, 虚拟物品(金融/贷款等)则无需
    @SerializedName("LGORT")
    private String warehouseCode;

    // 这个字段固定 ""
    @SerializedName("REBATE")
    private final String discountPercent = "";

    // 添加'A'；删除'D'；修改'C'
    // 目前逻辑只有新增, 删除
    @SerializedName("CHANGE")
    private String changeType = "";

    // 自动创建采购申请标识 采购'X'；不采购''
    @SerializedName("TOBUY")
    private String toBuy;

    @SerializedName("POSNR")
    private String sapLineNo;

    /** 以下字段是 保养包才会用到的字段 */
    /** 以下字段是 保养包才会用到的字段 */
    /** 以下字段是 保养包才会用到的字段 */

    /** 关键字段 */
    @SerializedName("ITOBJID")
    private String couponKeyword;

    /** 卡券ID */
    @SerializedName("ZNUMBER")
    private String couponId;

    /** 卡券描述 */
    @SerializedName("ZDESCRIBE")
    private String couponDesc;

    /** 卡券类别 A储值类、B基金类、C商品代金类、D商品服务类、E限额打折类 */
    @SerializedName("TYPE")
    private String couponType;

    /** 卡券分类 01项目类、02金额类 */
    @SerializedName("ZTYPE")
    private String couponZType;

    /** 储值本金 */
    @SerializedName("ZCZBJ")
    private final String couponPrincipal = "0";

    /** 储值赠送 */
    @SerializedName("ZCZZS")
    private final String couponGiftMoney = "0";

    /** 记账金额 */
    @SerializedName("ZKQJE")
    private String couponCreditMoney;

    /** 获取方式 */
    @SerializedName("ZHQFS")
    private String couponAquiredMethod;

    public boolean isChangeTypeAdd() {
        return CHANGE_TYPE_ADD.equals(changeType);
    }

    public boolean isChangeTypeDelete() {
        return CHANGE_TYPE_DELETE.equals(changeType);
    }

    // === setter & getter ====


    public String getCouponKeyword() {
        return couponKeyword;
    }

    public void setCouponKeyword(String couponKeyword) {
        this.couponKeyword = couponKeyword;
    }

    public String getCouponPrincipal() {
        return couponPrincipal;
    }

    public String getCouponGiftMoney() {
        return couponGiftMoney;
    }

    public String getCouponId() {
        return couponId;
    }

    public void setCouponId(String couponId) {
        this.couponId = couponId;
    }

    public String getCouponDesc() {
        return couponDesc;
    }


    public void setCouponDesc(String couponDesc) {
        if (null != couponDesc && couponDesc.length() > COUPON_DESC_MAX_LENGTH) {
            couponDesc = couponDesc.substring(0, COUPON_DESC_MAX_LENGTH);
        }
        this.couponDesc = couponDesc;
    }

    public String getCouponType() {
        return couponType;
    }

    public void setCouponType(String couponType) {
        this.couponType = couponType;
    }

    public String getCouponZType() {
        return couponZType;
    }

    public void setCouponZType(String couponZType) {
        this.couponZType = couponZType;
    }

    public String getCouponCreditMoney() {
        return couponCreditMoney;
    }

    public void setCouponCreditMoney(String couponCreditMoney) {
        this.couponCreditMoney = couponCreditMoney;
    }

    public String getCouponAquiredMethod() {
        return couponAquiredMethod;
    }

    public void setCouponAquiredMethod(String couponAquiredMethod) {
        this.couponAquiredMethod = couponAquiredMethod;
    }

    public String getExternalLineNo() {
        return externalLineNo;
    }

    public void setExternalLineNo(String externalLineNo) {
        this.externalLineNo = externalLineNo;
    }

    public String getMaterialNo() {
        return materialNo;
    }

    public void setMaterialNo(String materialNo) {
        this.materialNo = materialNo;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public String getQuantity() {
        return quantity;
    }

    public void setQuantity(String quantity) {
        this.quantity = quantity;
    }

    public String getItemCatalog() {
        return itemCatalog;
    }

    public void setItemCatalog(String itemCatalog) {
        this.itemCatalog = itemCatalog;
    }

    public String getWarehouseCode() {
        return warehouseCode;
    }

    public void setWarehouseCode(String warehouseCode) {
        this.warehouseCode = warehouseCode;
    }

    public String getDiscountPercent() {
        return discountPercent;
    }

    public String getChangeType() {
        return changeType;
    }

    public void setChangeType(String changeType) {
        this.changeType = changeType;
    }

    public String getSapLineNo() {
        return sapLineNo;
    }

    public void setSapLineNo(String sapLineNo) {
        this.sapLineNo = sapLineNo;
    }

    public String getToBuy() {
        return toBuy;
    }

    public void setToBuy(String toBuy) {
        this.toBuy = toBuy;
    }
}
